<template>
	<div class="mine">
		<div class="box">
			<div class="hearderBox">
				<div class="hearderBoxIcon" @click="goBack">
					<img src="../../assets/images/fanhuijiantou.png" alt="">
				</div>
				{{$t('indexTitle.title32')}}
			</div>
			<div class="proList">
				<div class="dfafaTimeBox">
					<div class="magBox">
						<div class="input-block"><label for="password">{{$t('indexTitle.title101')}}</label>
							<input type="date" v-model="startTime" @change="changes()">
						</div>
					</div>
					<div class="magBox">
						<div class="input-block"><label for="password">{{$t('indexTitle.title102')}}</label>
							<input type="date" v-model="endTime" @change="changes()">
						</div>
					</div>
				</div>
				<div class="zhuyiBox">
					<img src="../../assets/images/zhuyi.png" alt="">
					{{$t('indexTitle.title103')}}
				</div>
				<div class="btnssss" @click="chaxun()">{{$t('indexTitle.title104')}}</div>
			</div>
			<div class="navBox">
				<div class="navBoxIt" @click="goNextPage('/promotion',$t('indexTitle.title105'))">
					<img src="../../assets/icons/chongzhi.png" alt="">
					<p>{{$t('indexTitle.title105')}}</p>
					<p>{{tongjilist.cunkuan||0}}</p>
				</div>
				<div class="navBoxIt" @click="goNextPage('/promotion',$t('indexTitle.title106'))">
					<img src="../../assets/icons/tixian.png" alt="">
					<p>{{$t('indexTitle.title106')}}</p>
					<p>{{tongjilist.tikuan||0}}</p>
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion',$t('indexTitle.title107'))">
				<div class="proListItTop">
					{{$t('indexTitle.title107')}}
				</div>
				<div class="proListItBot">
					{{tongjilist.youhui||0}}
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion',$t('indexTitle.title108'))">
				<div class="proListItTop">
					{{$t('indexTitle.title108')}}
				</div>
				<div class="proListItBot">
					{{tongjilist.fanshui||0}}
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion',$t('indexTitle.title109'))">
				<div class="proListItTop">
					{{$t('indexTitle.title109')}}
				</div>
				<div class="proListItBot">
					{{tongjilist.shoudong||0}}
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion',$t('indexTitle.title110'))">
				<div class="proListItTop">
					{{$t('indexTitle.title110')}}
				</div>
				<div class="proListItBot">
					0
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion',$t('indexTitle.title111'))">
				<div class="proListItTop">
					{{$t('indexTitle.title111')}}
				</div>
				<div class="proListItBot">
					0
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<!-- <div class="proListIt" @click="goNextPage('/promotion','活动奖励记录')">
				<div class="proListItTop">
					活动奖励记录
				</div>
				<div class="proListItBot">
					0.00
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion','剩余活动点数')">
				<div class="proListItTop">
					剩余活动点数
				</div>
				<div class="proListItBot">
					0.00
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div>
			<div class="proListIt" @click="goNextPage('/promotion','投注锦标赛')">
				<div class="proListItTop">
					投注锦标赛
				</div>
				<div class="proListItBot">
					0.00
					<img src="../../assets/images/right.png" alt="">
				</div>
			</div> -->
		</div>
		<div class="jiazaidonghua" v-if="isloadingTowShow">
			<img src="../../assets/img/loading-ani.svg" alt="" />
		</div>
		<!-- <div class="buttons">
			<img src="../../assets/images/xiaoxi.png" alt="" />
		</div> -->
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		gettongji
	} from "../../utils/api.js"
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		components: {
			loadingFour
		},
		data() {
			return {
				startTime: "",
				endTime: "",
				tongjilist: [],
				isloadingTowShow: false,
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		created() {},
		mounted() {
			if(localStorage.getItem("tongjilistTow")){
				this.tongjilist = JSON.parse(localStorage.getItem('tongjilistTow'))
			}
			var getTime = new Date().getTime(); //获取到当前时间戳
			var time = new Date(getTime); //创建一个日期对象
			this.nowDate(time);
		},
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			chaxun() {
				this.isloadingTowShow = true;
				this.tongji()
			},
			nowDate(time) {
				this.isloadingTowShow = true;
				var year = time.getFullYear(); // 年
				var month = (time.getMonth() + 1).toString().padStart(2, '0'); // 月
				var date = time.getDate().toString().padStart(2, '0'); // 日
				this.startTime = year + "-" + month + "-" + date;
				this.endTime = year + "-" + month + "-" + date;
				this.tongji()
			},
			tongji() {
				this.tongjilist = [];
				let data = {
					start_time: this.startTime,
					end_time: this.endTime
				}
				gettongji(data).then((res) => {
					if (res.status.errorCode == 0) {
						this.tongjilist = res.data
						this.isloadingTowShow = false;
						localStorage.setItem('tongjilistTow', JSON.stringify(res.data))
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
					this.isloadingTowShow = false;
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			changes() {
				this.tongji()
			},
			goBack() {
				this.$router.push('/mine')
			},
			goNextPage(page, title) {
				this.$router.push({
					path: page,
					query: {
						title: title
					}
				});
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.mine {
		height: 90vh;
		overflow-y: auto;
		overflow-x: hidden;
		padding-top: calc(constant(safe-area-inset-top) + 0px);
		padding-top: calc(env(safe-area-inset-top) + 0px);
		padding-bottom: calc(constant(safe-area-inset-bottom) + 85px);
		padding-bottom: calc(env(safe-area-inset-bottom) + 85px);
		box-sizing: border-box;
		position: fixed;
		z-index: 1;
		-webkit-overflow-scrolling: touch;
		width: 100%;
	}

	.box {
		background-color: #fff;
		display: flex;
		flex-direction: column;
		/* min-height: 100vh; */
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}


	.hearderBox {
		width: 100%;
		height: 45px;
		background-color: #fff;
		position: fixed;
		top: 0;
		font-weight: 300;
		line-height: 45px;
		text-align: center;
		font-size: 20px;
		color: #545658;
		box-shadow: inset 0 -1px 0 #ececec;
		left: 0;
		overflow: hidden;
		z-index: 99;
	}

	.hearderBoxIcon {
		width: 50px;
		position: fixed;
		top: 3px;
		left: 0px;
	}

	.hearderBoxIcon img {
		width: 20px;
		height: 20px;
	}

	.proList {
		width: 100%;
		padding: 0px 0px 10px;
		margin-top: 50px;
	}

	.dfafaTimeBox {
		width: 95%;
		margin: 5px auto 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.magBox {
		width: 49%;
		border-radius: 5px;
		box-sizing: border-box;
		display: flex;
		height: 54px;
		justify-content: space-around;
		padding: 0 10px;
		background-color: #fbfbfb;
		border: 1px solid #e9e9e9;
		color: #777;
		font-weight: 300;
	}

	.input-block {
		box-sizing: border-box;
		position: relative;
		width: 100%;
	}

	.input-block label {
		color: #a0a3a5;
		line-height: 1.29;
		pointer-events: none;
		position: absolute;
		font-size: 10px !important;
		top: 8px !important;
		font-weight: 300;
	}

	.input-block input {
		background-color: transparent;
		color: #545658;
		border: none !important;
		box-sizing: border-box;
		position: absolute;
		width: 100%;
		outline: medium;
		padding: 0;
		font-size: 14px !important;
		font-family: sans-serif;
		font-size: 100%;
		line-height: 1.15;
		margin: 0;
		height: 28px !important;
		box-shadow: none !important;
		top: 24px !important;
	}

	.zhuyiBox img {
		width: 15px;
		height: 15px;
		margin-right: 5px;
	}

	.zhuyiBox {
		display: flex;
		font-size: 12px;
		margin: 5px auto 10px;
		color: #86898c;
		font-weight: 300;
		width: 95%;
	}

	.btnssss {
		background-color: #7240ff;
		border: none;
		border-radius: 3px;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
		font-stretch: normal;
		font-style: normal;
		font-weight: 300;
		height: 44px;
		width: 95%;
		margin: 20px auto 0;
		text-align: center;
		line-height: 44px;
	}

	.navBox {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.navBoxIt {
		width: 50%;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 130px;
	}

	.navBoxIt img {
		width: 35px;
		height: 35px;
	}

	.navBoxIt p:nth-child(2) {
		color: #939698;
		font-size: 16px;
		font-weight: 400;
		letter-spacing: normal;
		margin: 3px 0;
	}

	.navBoxIt p:nth-child(3) {
		font-size: 22px;
		font-weight: 500;
		color: #545658;
		letter-spacing: normal;
		margin: 0px;
	}

	.proListIt {
		width: 100%;
		padding: 15px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		box-sizing: border-box;
		border-bottom: 1px solid #e9e9e9;
	}

	.proListItTop {
		color: #939698;
		font-size: 16px;
		font-weight: 400;
	}

	.proListItBot {
		display: flex;
		align-items: center;
		font-size: 22px;
		font-weight: 500;
		letter-spacing: normal;
		color: #545658;
	}

	.proListItBot img {
		width: 20px;
		height: 20px;
		margin-left: 10px;
	}

	.jiazaidonghua {
		height: 100px;
		width: 100px;
		background-color: #313131;
		position: absolute;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 10px;
	}

	.jiazaidonghua img {
		height: 45px;
		width: 45px;
	}
</style>